package bavaria.hightech.formatter;

import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;

import bavaria.hightech.banking.Account;

public class AccStatementFormatterFactoryStaticImpl extends
		AccStatementFormatterFactory {

	@Override
	public AccStatementFormatter createAccStatementFormatter(String mimeType, String outputStream, Account acc) throws IOException {
        AccStatementFormatter formatter = null; 
        Object stream = null;
        
        if(outputStream.equals("file")){
        	stream = new FileWriter("FormattedAccStatement.txt",true);       	
        }else if(outputStream.equals("console")){
        	stream = new PrintStream(System.out);
        }
        if (mimeType.equals("text/plain")) {
            formatter = new AccStatementFormatterPlainTextImpl(acc,stream);
        } else if (mimeType.equals("text/html")) {
            formatter = new AccStatementFormatterHtmlImpl(acc,stream);
        }
        
        
        return formatter;
    }

}
